<template>
  <div class="func-comp-form">

    <ComponentGlobalSettingForm :id="id" :compConfigData="compConfigData"></ComponentGlobalSettingForm>

    <Tabs name="main_tabs" size="small" v-model="mainTabsValue">
      <TabPane name="main_tab" tab="main_tabs" label="主配置">

        <Tabs name="main_tabs_child" size="small">
          <TabPane tab="main_tabs_child" label="热力图配置">
            <Alert show-icon style="text-align: justify; padding-right: 10px;">
              热力图配置中，所有的配置在设计器中均不是实时生效，调整之后，请保存页面并刷新设计器或打开预览界面查看调整后的效果
            </Alert>
            <Form :label-width="120">
              <FormItem label="最大阈值">
                <InputNumber size="small" :max="10000000" :min="0" v-model="heatGridLayerOption.max"></InputNumber>
              </FormItem>
              <FormItem label="最小阈值">
                <InputNumber size="small" :max="10000000" :min="0" v-model="heatGridLayerOption.min"></InputNumber>
              </FormItem>
              <FormItem label="最大高度">
                <InputNumber size="small" :max="10000000" :min="0" v-model="heatGridLayerOption.maxHeight"></InputNumber>
              </FormItem>
              <FormItem label="最小高度">
                <InputNumber size="small" :max="10000000" :min="0" v-model="heatGridLayerOption.minHeight"></InputNumber>
              </FormItem>
              <FormItem label="柱子半径">
                <InputNumber size="small" :max="10000000" :min="0" v-model="heatGridLayerOption.gridSize"></InputNumber>
              </FormItem>
              <FormItem label="初始动画持续时间">
                <InputNumber size="small" :max="1000000" :min="0" v-model="heatGridLayerOption.riseTime"></InputNumber> 毫秒
              </FormItem>
              <FormItemPanel title="柱子渐变色配置">
                <FormItem label="起始位置">
                  <PnColorPicker size="small" v-model="heatGridLayerOption.gradient.startColor" alpha recommend/>
                </FormItem>
                <FormItem label="中间位置">
                  <PnColorPicker size="small" v-model="heatGridLayerOption.gradient.centerColor" alpha recommend/>
                </FormItem>
                <FormItem label="结束位置">
                  <PnColorPicker size="small" v-model="heatGridLayerOption.gradient.endColor" alpha recommend/>
                </FormItem>
              </FormItemPanel>
            </Form>
          </TabPane>
          <TabPane tab="main_tabs_child" label="地图配置">
            <BMapOptionConfigForm v-model="mapOption"></BMapOptionConfigForm>
          </TabPane>
        </Tabs>

      </TabPane>
      <TabPane name="datasource_tab" tab="main_tabs" label="数据源">
        <DatasourceState v-if="mainTabsValue == 'datasource_tab'" targetComp="BMapBarHeatGridComp"></DatasourceState>
      </TabPane>
      <TabPane name="interaction_tab" tab="main_tabs" label="交互">
        <Container v-if="mainTabsValue == 'interaction_tab'">
          <CustomJsDocument></CustomJsDocument>
          <BMapCustomJsDocument>
            <div slot="custom-code-item">
              <p><Tag color="primary">this.heatGridLayer</Tag>指向当前组件柱图层实例</p>
            </div>
          </BMapCustomJsDocument>
          <FormItemPanel title="初始化运行脚本">
            <CodeEditor v-model="customGlobalJsCode"></CodeEditor>
          </FormItemPanel>
        </Container>
      </TabPane>
    </Tabs>

  </div>
</template>

<script>

  import FuncCompFormMixin from '@/mixin/FuncCompFormMixin'

  import { createHelpers } from 'vuex-map-fields';

  const { mapFields } = createHelpers({
    getterType: 'designer/getLayoutItem',
    mutationType: 'designer/updateLayoutItem',
  });

  export default {
    name: 'BMapBarHeatGridCompForm', // 此名称必须填写，且必须与组件文件名相同，并且必须加上Form字符
    mixins: [FuncCompFormMixin],
    data() {
      return {}
    },
    mounted() {

    },
    methods: {},
    computed: {
      ...mapFields({

        mapOption: 'component.compConfigData.mapOption',
        heatGridLayerOption: 'component.compConfigData.heatGridLayerOption'

      })
    }
  }
</script>

<style scoped>

</style>
